<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link rel="stylesheet" type="text/css" href="<?php echo $this->_webroot('skin/css/admin.css'); ?>">
<link rel="stylesheet" type="text/css" href="<?php echo $this->_webroot('skin/css/main.css'); ?>">
<script type='text/javascript' src="<?php echo $this->_webroot('skin/js/jy.js'); ?>"></script>
<style>
td span {color:red;}
.green {color:green;}
.red {color:red;}
#divname{float:left; margin:0px;}
</style>
</head>
<body>
<input type="hidden" id="update_right" value="1" ></input>
<div id="maincontent">
	<div class="wrap">
    <div class="crumbs">当前位置 &gt;&gt; 交易管理&gt;&gt;订单查看</div>
        <hr />

		<div class="infobox">
			<h3><span class="left">订单查看</span><span class="right" style="margin-right:15px;"><a href="<?php echo $this->_url('admin/order/index/?');?>" style="float: right;">返回订单列表</a></span></h3>
			<div class="content2"> <span style="text-align:center;" align="middle">
				<?php if($info['order_status']==1 && $info['pay_status']==0){?>
				<a class="btn_ava"  onclick="window.location='<?php echo $this->_url('admin/order/orderview/?');?>order_id=<?php echo $info['id'];?>&state=1'"><span>取消订单</span></a>
				<?php }else{?>
				<a class="btn_unava"><span>取消订单</span></a>
				<?php }?>
				<?php if($info['pay_status']==0 && ($info['order_status']==1 || $info['order_status']==2)){?>
				<a class="btn_ava"  onclick="window.location='<?php echo $this->_url('admin/order/orderview/?');?>order_id=<?php echo $info['id'];?>&state=2'"><span>付&nbsp;&nbsp;款</span></a>
				<?php }else{?>
				<a class="btn_unava"><span>付款</span></a>
				<?php }?>
				<?php if($info['transport_status']==0 && $info['order_status']==2){?>
				<a class="btn_ava"  onclick="window.location='<?php echo $this->_url('admin/order/orderview/?');?>order_id=<?php echo $info['id'];?>&state=3'"><span>商家发货</span></a>
				<?php }else{?>
				<a class="btn_unava"><span>商家发货</span></a>
				<?php }?>
				<?php if($info['transport_status']==1 && $info['pay_status']==1 && ($info['order_status']==1 || $info['order_status']==2)){?>
				<a class="btn_ava"  onclick="window.location='<?php echo $this->_url('admin/order/orderview/?');?>order_id=<?php echo $info['id'];?>&state=4'"><span>确认收货</span></a>
				<?php }else{?>
				<a class="btn_unava"><span>确认收货</span></a>
				<?php }?>
				</span>
				<form action="<?php echo $this->_url('admin/order/doeditdate/?');?>" method="post" onsubmit="return check();">
					<table class="list_table" >
						<thead>
							<tr>
								<th colspan="4">&nbsp;&nbsp;商品信息</th>
							</tr>
						</thead>
						<tbody>
							<tr style="text-align:center;">
								<td align="left" width="270px">&nbsp;&nbsp;商品名称</td>
								<td width="100px">商品价格</td>
								<td width="80px">购买数量</td>
								<td width="" align="left">运费</td>
							</tr>
							<?php  	foreach ($info['order_goods'] as $k=>$v){      ?>
							<tr style="text-align:center;">
								<td align="left">&nbsp;&nbsp;<?php echo $v['ordergoods']['goods_name'];?></a></td>
								<td><?php echo $v['ordergoods']['goods_price'];?>元</td>
								<td><?php echo $v['ordergoods']['order_num'];?></td>
								<td align="left"><?php echo $info['ordergoods']['good_tran'];?>元</td>
							</tr>
							<?php } ?>
							<tr>
								<td align="left" colspan="4">&nbsp;&nbsp;订单金额：<input type="text" name="order_value" value="<?php echo $info['order_value'];?>"/>元&nbsp;&nbsp;实付款：<?php echo $info['order_actual'];?>元</td>
							</tr>
						</tbody>
					</table>
					<table class="list_table" style="float:left; width:32%; margin-right:2%">
						<thead>
							<tr>
								<th colspan="2">&nbsp;&nbsp;管理中心</th>
							</tr>
						</thead>
						<tbody>
							<tr><input type="hidden" name="order_id" value="<?php echo $info['id'];?>"/>
								<td width="80px">&nbsp;&nbsp;联系人：</td>
								<td><input type="text" name="consignee" value="<?php echo $info['consignee'];?>"/></td>
							</tr>
							<tr>
								<td>&nbsp;&nbsp; 手　机：</td>
								<td><input type="text" name="mobile" value="<?php echo $info['mobile'];?>"/></td>
							</tr>
							<tr>
								<td>&nbsp;&nbsp;电　话：</td>
								<td><input type="text" name="telphone" value="<?php echo $info['telphone'];?>"/></td>
							</tr>
							<tr>
								<td>&nbsp;&nbsp; 邮　箱：</td>
								<td><input type="text" name="email" value="<?php echo $info['email'];?>"/></td>
							</tr>
							<tr>
								<td>所在地区：</td>
								<td>
								<span id="user_country">
								<select name="data[shopinfo][shop_country]" onchange="areachanged(this.value,0);">
									<option value='0'>选择国家</option>
								 <?php   foreach($areas_info[0] as $v){?>
									<option value="<?php echo  $v['id'];?>" <?php  if($v['id']==$shop_info['shop_country']){echo 'selected';}?>><?php echo  $v['area_name'];?></option>
								<?php }?>
								</select>
								</span>
								
								<span id="user_province"><?php  if($shop_info['shop_country']){?>
								<select name="data[shopinfo][shop_province]" onchange="areachanged(this.value,1);">
									<option value='0'>选择省份</option>
								<?php foreach($areas_info[1] as $v) {
										if($v['parent_id'] == $shop_info['shop_country']){?>
									<option value="<?php echo  $v['id'];?>" <?php   if($v['id']==$shop_info['shop_province']){echo 'selected';}?>><?php echo  $v['area_name'];?></option>
								<?php 	}
								}?>
								</select>
								<?php }?>
								</span>
								
								<span id="user_city">
								<?php 	 if($shop_info['shop_province']){?>
								<select name="data[shopinfo][shop_city]" onchange="areachanged(this.value,2);">
									<option value='0'>选择城市</option>
								    <?php foreach($areas_info[2] as $v) {
										if($v['parent_id'] == $shop_info['shop_province']){?>
									<option value="<?php echo  $v['id'];?>" <?php  if($v['id']==$shop_info['shop_city']){echo 'selected';}?>><?php echo  $v['area_name'];?></option>
								<?php 	}
								}?></select>
								<?php }?>
								</span>
								
								<span id="user_district">
								<?php  if($shop_info['shop_city']) {?>
								<select name="data[shopinfo][shop_district ]">
									<option value='0'>选择地区</option>
								<?php foreach($areas_info[3] as $v) {
										if($v['parent_id'] == $shop_info['shop_city']){?>
									<option value="<?php echo  $v['id'];?>" <?php   if($v['id']==$shop_info['shop_district']){echo 'selected';}?>><?php echo  $v['area_name'];?></option>
								<?php 	}
								}?>
								</select>
								<?php }?>
								</span>
					            <span class="red">*</span>							
								</td>
							</tr>
							<tr>
								<td>&nbsp;&nbsp;详细地址：</td>
								<td><input type="text" name="address" value="<?php echo $info['address'];?>"/></td>
							</tr>
							<tr>
								<td>&nbsp;&nbsp;邮政编码：</td>
								<td><input type="text" name="zipcode" value="<?php echo $info['zipcode'];?>"/></td>
							</tr>
						</tbody>
					</table>
					<table class="list_table" style="float:left; width:32%; margin-right:2%">
						<thead>
							<tr>
								<th colspan="2">&nbsp;&nbsp;发货信息</th>
							</tr>
						</thead>
						<tbody>
							<tr>
								<td width="100">&nbsp;&nbsp; 商家名称：</td>
								<td><?php echo $info['shop_name'];?></td>
							</tr>
							<tr>
								<td>&nbsp;&nbsp;物流公司名称：</td>
								<td><input type="text" name="shipping_name" value="<?php echo $info['shipping_name'];?>"/></td>
							</tr>
							<tr>
								<td>&nbsp;&nbsp;物流发货单号：</td>
								<td><input type="text" name="shipping_no" value="<?php echo $info['shipping_no'];?>"/></td>
							</tr>
							<tr>
								<td>&nbsp;&nbsp;发货运输类型：</td>
								<td><input type="text" name="shipping_type" value="<?php echo $info['shipping_type'];?>"/></td>
							</tr>
							<tr>
								<td>&nbsp;&nbsp;发货时间：</td>
								<td><?php echo $info['shipping_time'];?></td>
							</tr>
						</tbody>
					</table>
					<table class="list_table" style="float:left; width:32%;" >
						<thead>
							<tr>
								<th colspan="2">&nbsp;&nbsp; 订单信息</th>
							</tr>
						</thead>
						<tbody>
							<tr>
								<td width="100">&nbsp;&nbsp;订单ID：</td>
								<td><?php echo $info['payid'];?></td>
							</tr>
							<tr>
								<td>&nbsp;&nbsp;商家收款方式：</td>
								<td><select name="pay_name">
									<?php foreach ($payarr as $val){
										?><option <?php if($val['pay_name'] === $info['pay_name']){ echo "selected";}?>><?php echo $val['pay_name'];?></option><?php
									}?>
								</select></td>
							</tr>
							<tr>
								<td>&nbsp;&nbsp;订单附言：</td>
								<td><?php echo $info['message'];?></td>
							</tr>
							<tr>
								<td>&nbsp;&nbsp;下订单时间：</td>
								<td><?php echo $info['order_time'];?></td>
							</tr>
							<tr>
								<td>&nbsp;&nbsp;支付时间：</td>
								<td><?php echo $info['pay_time'];?></td>
							</tr>
							<tr>
								<td>&nbsp;&nbsp;收货时间：</td>
								<td><?php echo $info['receive_time'];?></td>
							</tr>
						</tbody>
					</table>
					<div class="clear"></div>
					<div><input type="submit" name="submit" value="确定"/></div>
				</form>
			</div>
		</div>		
		
		
		
		
		
		
	</div>
</div>
<script language="JavaScript" src="<?php echo $this->_webroot('servtools/ajax_client/ajax.js'); ?>"></script>
<script language="JavaScript">
<!--
var utype = '';
function areachanged(value,type){
	if(value > 0) {	
		ajax("<?php echo $this->_url('admin/order/getareas');?>","POST","value="+value+"&mode=shopinfo&pre=shop_&type="+type,function(return_text){
			var return_text = return_text.replace(/[\n\r]/g,"");
			if(return_text==""){
				alert("请重新选择!！");
			} else {
				if(type==0) {
					document.getElementById("user_province").innerHTML = return_text;
					show("user_province");
					hide("user_city");
					hide("user_district");
				} else if(type==1) {
					document.getElementById("user_city").innerHTML = return_text;
					show("user_city");
					hide("user_district");
				} else if(type==2) {
					document.getElementById("user_district").innerHTML = return_text;
					show("user_district");
				}
			}
		});
	} else {
		if(type==2) {
			hide("user_district");
		} else if(type==1) {
			hide("user_district");
			hide("user_city");
		} else if(type==0) {
			hide("user_district");
			hide("user_city");
			hide("user_province");
		}
	}
}


function check() {
	var order_value = document.getElementsByName("order_value")[0];
	if(order_value.value=='') {
		alert("订单金额不能为空!");
		order_value.focus();
		return false;
	}
	var consignee = document.getElementsByName("consignee")[0];
	if(consignee.value=='') {
		alert("联系人不能为空!");
		consignee.focus();
		return false;
	}
	var mobile = document.getElementsByName("mobile")[0];
	var telphone = document.getElementsByName("telphone")[0];
	if(mobile.value=='' &amp;&amp; telphone.value=='') {
		alert("手机和电话不能都为空!");
		mobile.focus();
		return false;
	}
	var email = document.getElementsByName("email")[0];
	var user_email_reg = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
	if(!email.value=='' &amp;&amp; !user_email_reg.test(email.value)){
		alert("请您正确填写邮箱!");
		email.focus();
	}
	var province = document.getElementsByName('province')[0];
	if(province.value==0){
		alert("请您选择省份!");
		return false;
	}

	var city = document.getElementsByName('city')[0];
	if(city.value==0){
		alert("请您选择城市!");
		return false;
	}

	var district = document.getElementsByName('district')[0];
	if(district.value==0){
		alert("请您选择市区!");
		return false;
	}
	
	var address = document.getElementsByName('address')[0];
	if(address.value==''){
		alert("详细地址不能为空！");
		return false;
	}

	var shipping_name = document.getElementsByName('shipping_name')[0];
	if(shipping_name.value==''){
		alert("物流公司名称不能为空!");
		return false;
	}

	var shipping_no = document.getElementsByName('shipping_no')[0];
	if(shipping_no.value==''){
		alert("物流发货单号不能为空!");
		return false;
	}
	return true;
}


function hide(id) {
	document.getElementById(id).style.display = 'none';
}
function show(id) {
	document.getElementById(id).style.display = '';
}

function imgmover(obj) {
	obj.style.border = '2px solid #E38016';
}

function imgmout(obj) {
	obj.style.border = '2px solid #eee';
}

function wshowimg(v) {
	var width = document.body.clientWidth;
	var showimg = document.getElementById("showimg");
	var imgsrc = document.getElementById("imgsrc");

	var left = "100";
	if(width) {
		left = (width-400)/2;
	}
	showimg.style.left = left+"px";
	showimg.style.display = '';
	imgsrc.src = v;
	document.getElementById("hiddeninput").focus();
}

function whideimg() {
	var showimg = document.getElementById("showimg");
	showimg.style.display = 'none';
}

//-->
</script>
</body>
</html>